---
title: Configuration.connectSOCKS()
api: Configuration.connectSOCKS
---

## Description

<Summary/>

<FilterDiagram
  name="connectSOCKS"
  input="Data"
  output="Data"
  subInput="Data"
  subOutput="Data"
  subType="link"
/>

A _connectSOCKS_ filter pumps its input _Data_ stream into a newly created sub-pipeline, prepended by a SOCKS connection request. Its output is the _Data_ stream coming out of the sub-pipeline, with the leading SOCKS connection response removed.

## Syntax

``` js
pipy()
  .pipeline()
  .connectSOCKS(destination).to(
    subPipelineLayout
  )

pipy()
  .pipeline()
  .connectSOCKS(
    () => getDestination()
  ).to(
    subPipelineLayout
  )
```

## Parameters

<Parameters/>

## Example

``` js
pipy()

  .listen(8443)
  .connectSOCKS(
     'example.com:443', // the destination address we intend to connect to
  ).to(
    $=>$.connect(
      'localhost:1080' // suppose we have a local SOCKS proxy on port 1080
    )
  )
```

## See Also

* [Configuration](/reference/api/Configuration)
* [acceptSOCKS()](/reference/api/Configuration/acceptSOCKS)
